<?php
	$list = $mvc->getObject('list');
	if(!isset($list) || count($list) == 0){
?>
<span class="message warning">
	Oops... seems the address you have entered is invalid. There are no courses for such criterias.<br />
	But you may still find some courses of interest by browsing our <a href="/schools.html" title="Schools">Schools</a> directory.
</span>
<?php } else { ?>
<div class="pgListItem wide">
	<h1><?php echo $list[CourseService::CAPTION];?></h1>
	<div class="pgItemImg"><img src="<?php echo $list[CourseService::AVATAR];?>" alt="" title="" /></div>
	   <div class="pgItemBody">
	       <ul>
       		<li>
	       		<span>Rating:</span><span class="lsValue">
	       			<?php if($list[CourseService::RATE] >= 1){ ?>
					<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
					<?php if($list[CourseService::RATE] >= 2){ ?>
					<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
					<?php if($list[CourseService::RATE] >= 3){ ?>
					<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
					<?php if($list[CourseService::RATE] >= 4){ ?>
					<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
					<?php if($list[CourseService::RATE] >= 5){ ?>
					<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
				</span>
			</li>
         	<li><span>Base fee:</span><span class="lsValue"><?php echo $list[CourseService::BASE_FEE];?>$ / mon</span></li>
         	<li><span>Subjects:</span>
	         		<span class="lsValue">
	         			<a href="/courses.html?id=<?php echo $list[CourseService::CATEGORY_ID];?>">
	         				<?php echo $list[CategoriesService::NAME];?>
	         			</a>
	         		</span>
				</li>
	     	</ul>
		</div>
	<p><?php echo $list[CourseService::DESCRIPTION];?></p>
</div>
<div class="subHeader">
	<b>Exercises Available:</b>
</div>
<div>
<?php
	$exerciselist = $mvc->getObject('exerciselist');
	if(!isset($exerciselist) || count($exerciselist) == 0){
?>
<span class="message warning">
	Sorry, there are no course exercises available at this moment.<br/>
	Please visit course later. It will be updated very soon.
</span>
<?php } else { ?>
<?php foreach($exerciselist as $key => $value){ ?>
	<div class="pgListItem wide">
        <h2>
			<a href="<?php echo "/exercise-details.html?id=" . $value[CourseService::ID] ?>">
				<?php echo $value[ExerciseService::CAPTION];?>
			</a>
		</h2>
		<div class="pgItemImg">
			<img src="storage/video.jpg" alt="video"></img>
		</div>
	   	<div class="pgItemBody">
	   	<ul>
			<li><span>Rating:</span>
			<span class="lsValue">
       			<?php if($value[ExerciseService::RATE] >= 1){ ?>
				<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
				<?php if($value[ExerciseService::RATE] >= 2){ ?>
				<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
				<?php if($value[ExerciseService::RATE] >= 3){ ?>
				<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
				<?php if($value[ExerciseService::RATE] >= 4){ ?>
				<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
				<?php if($value[ExerciseService::RATE] >= 5){ ?>
				<img src="images/star.png" /> <?php }else{ ?> <img src="images/gray-star.png" /><?php } ?>
			</span>
			</li>
		</ul>
			<p>
				<?php echo $value[ExerciseService::DESCRIPTION];?>
				<a href="<?php echo 'exercise-details.html?id=' . $value[ExerciseService::ID];?>" title="View">More...</a>
			</p>
		</div>
	</div>
	<div class="clnr brdr">&nbsp;</div>
<?php } } ?>
</div>
<?php } ?>